home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / TEXTDISP.H < prev    next >
C/C++ Source or Header  |  1980-01-03  |  3KB  |  111 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * TextDisplay - basic text displaying
  25.  */
  26.  
  27. #ifndef textdisplay_h
  28. #define textdisplay_h
  29.  
  30. #include <InterViews/defs.h>
  31.  
  32. enum CaretStyleOptions {
  33.     NoCaret, DefaultCaret, BarCaret, UnderscoreCaret, OutlineCaret
  34. };
  35.  
  36. class Painter;
  37. class Canvas;
  38.  
  39. class TextDisplay {
  40. public:
  41.     TextDisplay(boolean autosized = false);
  42.     ~TextDisplay();
  43.  
  44.     void Draw(Painter*, Canvas*);
  45.     void LineHeight(Coord height);
  46.     void TabWidth(Coord width);
  47.  
  48.     void Scroll(int line, Coord x, Coord y);
  49.  
  50.     void Resize(Coord xmin, Coord ymin, Coord xmax, Coord ymax);
  51.     void Bounds(Coord& xmin, Coord& ymin, Coord& xmax, Coord& ymax);
  52.     void Redraw(Coord l, Coord b, Coord r, Coord t);
  53.  
  54.     void InsertLinesAfter(int line, int count = 1);
  55.     void InsertLinesBefore(int line, int count = 1);
  56.     void DeleteLinesAfter(int line, int count = 1);
  57.     void DeleteLinesBefore(int line, int count = 1);
  58.  
  59.     void InsertText(int line, int index, const char*, int count);
  60.     void DeleteText(int line, int index, int count);
  61.     void ReplaceText(int line, const char*, int count);
  62.  
  63.     void Style(int line1, int index1, int line2, int index2, int style);
  64.     void AddStyle(int line1, int index1, int line2, int index2, int style);
  65.     void RemoveStyle(int line1, int index1, int line2, int index2, int style);
  66.  
  67.     void Caret(int line, int index);
  68.     void CaretStyle(int);
  69.  
  70.     int LineNumber(Coord y);
  71.     int LineIndex(int line, Coord x, boolean between = true);
  72.  
  73.     Coord Width();
  74.     Coord Height();
  75.  
  76.     Coord Base(int line);
  77.     Coord Top(int line);
  78.     Coord Left(int line, int index);
  79.     Coord Right(int line, int index);
  80. private:
  81. friend class TextLine;
  82.  
  83.     void Size(int, int);
  84.     TextLine* Line(int, boolean);
  85.     int Index(int);
  86.     void HideCaret();
  87.     void ShowCaret();
  88.  
  89.     Painter* painter;
  90.     Canvas* canvas;
  91.     boolean autosized;
  92.     Coord xmin, xmax;
  93.     Coord ymin, ymax;
  94.     Coord x0, y0;
  95.     Coord width;
  96.     int lineheight;
  97.     int tabwidth;
  98.     TextLine** lines;
  99.     int maxlines;
  100.     int firstline;
  101.     int lastline;
  102.     int topline;
  103.     int bottomline;
  104.     int widestline;
  105.     int caretline;
  106.     int caretindex;
  107.     int caretstyle;
  108. };
  109.  
  110. #endif
  111.